# $Id: PKGBUILD 90080 2013-05-06 19:39:10Z foutrelis $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: red_over_blue
# Contributor: neri

pkgname=povray
pkgver=3.7.0.RC6
pkgrel=7
pkgdesc='Script based raytracer for creating 3D graphics'
arch=('x86_64' 'i686')
license=('custom')
url='http://povray.org/'
depends=('libtiff' 'libpng' 'boost-libs')
makedepends=('boost')
backup=("etc/povray/${pkgver%.*.*}/povray.conf"
        "etc/povray/${pkgver%.*.*}/povray.ini")
source=("http://www.povray.org/redirect/www.povray.org/beta/source/$pkgname-$pkgver.tar.gz"
        'povray3.7.0_rc3-user-conf.patch'
        'distribution-license.txt'
        'LICENSE'
        'source-license.txt')
sha256sums=('374957bdb90fb7be5f36f839b3f04ab0a4340f6e8cf369f658d6592a342803e3'
            '95b04ec4973e6e8a80fc83df2e3caff0b4d6699c4154144f3017d42cab7236e0'
            'bcf6893c741568bbff6839bb7310b0c43af8cb54bae792da21123e1026f91ae9'
            '9162060797de4f7f91ccf5e1fac5ec3378a0b0fed382393797ba3f4f27896402'
            '7d80992314f7947f5f672a4ad8b1d072a6179f01fb0228a88e4224a8bd45de96')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  sed -i 's:=no:=yes:' unix/config/ax_boost_thread.m4
  sed -i 's:AC_MSG_FAILURE(\[c:AC_MSG_RESULT(\[:' configure.ac
  sed -i 's:TIME_UTC:TIME_UTC_:' \
    source/backend/scene/view.cpp \
    vfe/vfepovms.cpp \
    vfe/vfesession.cpp
  ./bootstrap
  patch -p1 < ../povray3.7.0_rc3-user-conf.patch
  COMPILED_BY="Arch Linux" ./configure --prefix=/usr --sysconfdir=/etc
  make CXXFLAGS+="-lboost_system"
  gzip povray.1
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  mkdir -p "$pkgdir/usr/share/$pkgname-3.7"
  cp -r icons include ini scenes scripts "$pkgdir/usr/share/$pkgname-3.7"
  mkdir -p "$pkgdir/usr/share/doc/$pkgname-3.7"
  cp -r doc "$pkgdir/usr/share/doc/$pkgname-3.7"
  install -Dm755 unix/povray "$pkgdir/usr/bin/povray"
  install -Dm644 povray.conf "$pkgdir/etc/povray/3.7/povray.conf"
  install -Dm644 povray.ini "$pkgdir/etc/povray/3.7/povray.ini"
  install -Dm644 povray.1.gz "$pkgdir/usr/share/man/man1/povray.1.gz"
  install -Dm644 ../LICENSE \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 ../distribution-license.txt \
    "$pkgdir/usr/share/licenses/$pkgname/distribution-license.txt"
  install -Dm644 ../source-license.txt \
    "$pkgdir/usr/share/licenses/$pkgname/source-license.txt"
}

# vim:set ts=2 sw=2 et:
